package com.hqyj.springboot.springboot_multiple_payment.service.impl;

import com.hqyj.springboot.springboot_multiple_payment.mapper.PaymentMapper;
import com.hqyj.springboot.springboot_multiple_payment.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Order;
import pojo.Payment;

@Service("paymentService")
public class PaymentServiceImpl implements PaymentService {
    @Autowired
    private PaymentMapper paymentMapper;

    @Override
    public boolean appendPayment(Order order) {
        boolean bol = false;
        Payment payment = new Payment();
        payment.setPayment_name("蚂蚁借呗");
        payment.setPayment_amount(order.getOrder_amount());
        int insertPayment = paymentMapper.insertPayment(payment);
        if (insertPayment > 0){
            bol = true;
        }
        return bol;
    }
}
